package com.servlet;

import javax.servlet.http.HttpServlet;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import com.config.CONFIG;


/**
 * @author luanzhe
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class InitServlet extends HttpServlet{
	Logger logger = Logger.getLogger(InitServlet.class);
	public void init() {
		initLog4j();
		initConfig();
	}
	
	private void initLog4j(){
		String prefix = getServletContext().getRealPath("/");
		String file = getInitParameter("log4j");     
		logger.info("log4j start....." + prefix+file);
		if(file != null) {
			PropertyConfigurator.configure(prefix+file);
		}
	}
	private void initConfig(){
		CONFIG.getInstance();
	}
}
